<template>
  <template v-if="homeList.length>0">
    <Row >
      <Col v-for="item in homeList">
        <Card style="width:120px;margin: 8px" @click="turntoPage(item.name)">
          <div style="text-align:center">
            <svg v-if="item.meta.iconFont" class="icon" aria-hidden="true">
              <use v-bind:xlink:href="item.meta.iconFont"></use>
            </svg>
            <Icon v-else :type="item.meta.icon" />

            <h3>{{ item.meta.title }}</h3>
          </div>
        </Card>
      </Col>
    </Row>
  </template>
  <template v-else>
    暂无模块
  </template>


</template>

<script setup>
import {turnToPage} from 'module-base/lib/sideMenuHandle'
import {ref} from 'vue'

import {useRouter} from 'vue-router'
import {onMounted} from "vue";
const router = useRouter()

function turntoPage(route){
  let r=route?route: 'createScreen_page'
  turnToPage(router,r)
}

const homeList=ref([])
function getHomeList(list){
  return list.filter((v,i)=>{
    if(v.meta.isHomeList){
      return v
    }
  })
}
onMounted(()=>{
  homeList.value=getHomeList(router.getRoutes())
})
</script>

<style scoped>

</style>
